home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / _EXIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  470 b   |  18 lines

  1. /* _exit.c --- BIBLE pp. 84-85 */
  2. #include <stdio.h>
  3. main()
  4. {
  5.     FILE *fp;
  6.     char filename[40];
  7.     printf("Enter name of file to be opened for writing:");
  8.     gets(filename);
  9.     if((fp = fopen(filename, "w+")) == NULL)
  10.     {
  11.         perror("File open error");
  12.         abort();
  13.     }
  14.     fprint(fp, "If you use \"_exit\", this line will not appear in "
  15.             "the file\nbecause it flushes buffers\n", filename);
  16.     printf("TYPE %s to see if buffers were flushed\n", filename);
  17.     _exit(0);
  18. }